package com.qf.controller;


import com.qf.service.GoodsService;
import com.qf.utils.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    GoodsService goodsService;

    @GetMapping("/findAll")
    public ResultMsg findAll() {
        return goodsService.findAll();
    }

    @GetMapping("/findOne/{goodsId}")
    public ResultMsg findOne(@PathVariable Integer goodsId) {
        return goodsService.findOne(goodsId);
    }

    @GetMapping("/findAllByKeyword")
    public ResultMsg findsAllByKeywords(@RequestParam(required = false, defaultValue = "") String keywords) {
        return goodsService.findAllByKeywords(keywords);
    }

}
